<select id="country" class="register_option">
    <option value="" disabled selected>--Please choose--</option>

    <% if (typeof(search) !== 'undefined') { %>
    <option value=""> Any where </option>
    <% } %>

    <% var selectedCNT = 0; %>
    <% for (var i in arr) { %>
        <% if (typeof(val)!=='undefined') { %>
            <% if ( val == arr[i].value && selectedCNT == 0 ) { %>
            <% selectedCNT++; %>
            <option val="<%=arr[i].label%>" value=<%=arr[i].value%> selected="selected"> <%=arr[i].label%></option>
            <% } else { %>
                <% if (arr[i].value != ''){ %>
                   <option  val="<%=arr[i].label%>" value=<%=arr[i].value%>> <%=arr[i].label%></option>
                <% } else { %>
                   <option  val="<%=arr[i].label%>" disabled value=<%=arr[i].value%> > <%=arr[i].label%></option>
                <% } %>
            <% } %>
        <% } else { %>
            <% if (arr[i].value != '') { %>
               <option  val="<%=arr[i].label%>" value=<%=arr[i].value%>> <%=arr[i].label%></option>
            <% } else { %>
               <option  val="<%=arr[i].label%>" disabled value=<%=arr[i].value%>> <%=arr[i].label%></option>
            <% } %>
        <% } %>
    <% } %>
</select>
